import com.tinkerforge.BrickIMU.AccelerationListener;
import com.tinkerforge.BrickIMU.AngularVelocityListener;
import com.tinkerforge.BrickIMU.MagneticFieldListener;
import com.tinkerforge.BrickIMU.OrientationListener;
import com.tinkerforge.BrickletTemperature.TemperatureListener;


public class DetectorMain {

	/**
	 * @param args
	 */

	private DetectorSensor earthAct;

	public static void main(String[] args) {
		DetectorMain earthQuake = null;
		try {
			earthQuake = new DetectorMain();
			
			System.in.read();

			earthQuake.stop();
		} catch (final Exception ex) {
			ex.printStackTrace();
		}
	}


	private void stop() {
		if (this.earthAct != null) {
			this.earthAct.disconnect();
		}
	}


	public DetectorMain()
	{
		this.earthAct = new DetectorSensor(new accList(), new magnList(), new angList(), new orientList());

		try {
			this.earthAct.connect();
			this.earthAct.init();
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}

	}

}

class accList implements AccelerationListener {

	@Override
	public void acceleration(short x, short y, short z) {
		DetectorSensor.setAcceleration(x,y,z);

	}
}

class orientList implements OrientationListener {

	@Override
	public void orientation(short roll, short pitch, short yaw) {
		DetectorSensor.setOrientation(roll, pitch, yaw);

	}

}

class magnList implements MagneticFieldListener {

	@Override
	public void magneticField(short x, short y, short z) {
		DetectorSensor.setMagField(x,y,z);
	}

}

class angList implements AngularVelocityListener{

	@Override
	public void angularVelocity(short x, short y, short z) {
		DetectorSensor.setAngular(x,y,z);
	}

}

class tempList implements TemperatureListener{

	@Override
	public void temperature(short temperature) {
		DetectorSensor.setTemp(temperature);

	}

}

